Build:Replace soft links with file copy.
authorEvan Lloyd <[email protected]>
Wed, 2 Dec 2015 20:30:13 +0000 (20:30 +0000)
committerEvan Lloyd <[email protected]>
Fri, 1 Apr 2016 11:33:09 +0000 (12:33 +0100)
Some build environments do not support symbolic links. This patch
removes the symlinks previously used to build fip_create and instead
copies the relevant header files.
The original motivation for using symlinks was to avoid Trusted Firmware
library headers conflicting with headers in the compiler standard
include path. Copying the header files instead has the same effect.

Like other build artefacts, the copied files are listed in .gitignore.

The distclean targets have also been updated to remove the copies.

Change-Id: Ie8b67bcb133f7f1d660ae93b857950aa15e42b1e

.gitignore
tools/fip_create/Makefile
tools/fip_create/firmware_image_package.h [deleted symlink]
tools/fip_create/uuid.h [deleted symlink]

index cc5cbfb4300036a6abc0cf17de60abe0cffe1efb..a3b5e391d851469b28ac2827174a2a29342ec7e9 100644 (file)
@@ -14,3 +14,7 @@ tools/fip_create/fip_create
 tools/cert_create/src/*.o
 tools/cert_create/src/**/*.o
 tools/cert_create/cert_create
+
+# Ignore header files copied.
+tools/fip_create/firmware_image_package.h
+tools/fip_create/uuid.h
index 52e06a7ea5465377e3cb3a724c0bac2806fa3447..da993024fe1dc7a4a0d7d92e99240b8ea244c20a 100644 (file)
@@ -34,6 +34,7 @@ include ${MAKE_HELPERS_DIRECTORY}build_env.mk
 
 PROJECT = fip_create
 OBJECTS = fip_create.o
+COPIED_H_FILES := uuid.h firmware_image_package.h
 
 CFLAGS = -Wall -Werror -pedantic -std=c99
 ifeq (${DEBUG},1)
@@ -42,13 +43,12 @@ else
   CFLAGS += -O2
 endif
 
-# Make soft links and include from local directory otherwise wrong headers
-# could get pulled in from firmware tree.
+# Only include from local directory (see comment below).
 INCLUDE_PATHS = -I.
 
 CC := gcc
 
-.PHONY: all clean
+.PHONY: all clean distclean
 
 all: ${PROJECT}
 
@@ -59,10 +59,25 @@ ${PROJECT}: ${OBJECTS} Makefile
        @echo "Built $@ successfully"
        @${ECHO_BLANK_LINE}
 
-%.o: %.c %.h Makefile
+%.o: %.c %.h ${COPIED_H_FILES} Makefile
        @echo "  CC      $<"
        ${Q}${CC} -c ${CFLAGS} ${INCLUDE_PATHS} $< -o $@
 
+#
+# Copy required library headers to a local directory so they can be included
+# by this project without adding the library directories to the system include
+# path. This avoids conflicts with definitions in the compiler standard
+# include path.
+#
+uuid.h : ../../include/stdlib/sys/uuid.h
+       $(call SHELL_COPY,$<,$@)
+
+firmware_image_package.h : ../../include/common/firmware_image_package.h
+       $(call SHELL_COPY,$<,$@)
+
 clean:
        $(call SHELL_DELETE_ALL, ${PROJECT} ${OBJECTS})
 
+distclean: clean
+       $(call SHELL_DELETE_ALL, ${COPIED_H_FILES})
+
diff --git a/tools/fip_create/firmware_image_package.h b/tools/fip_create/firmware_image_package.h
deleted file mode 120000 (symlink)
index cc61903..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../include/common/firmware_image_package.h
\ No newline at end of file
diff --git a/tools/fip_create/uuid.h b/tools/fip_create/uuid.h
deleted file mode 120000 (symlink)
index c77762f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../include/stdlib/sys/uuid.h
\ No newline at end of file